package truef.service.seller.service;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.software.base.service.GenericGenerator;
import truef.seller.domain.CustomService;
import truef.seller.domain.Seller;
import truef.service.seller.service.CustomServiceManager;
import truef.service.seller.service.SellerManager;

public class sellerEntityGenerator extends GenericGenerator {
	@Autowired
	SellerManager sellerManager;
	
	@Autowired
	CustomServiceManager customServiceManager;

	@Test
	 public void gen_seller() {
        for (int i = 0; i < 5; i++) {
            Seller g = new Seller();
            g.setName("seller_" + i);
            this.sellerManager.save(g);
            for (int j = 0; j < 5; j++) {
                Seller seller = new Seller();
                seller.setName("seller_" + i + "_" + j);
               seller.setParent(g);
                g = this.sellerManager.save(seller);
                this.gen_customService(g);
            }
        }
    }
	
	public void gen_customService(Seller g) {
		for (int i = 0; i < 5; i++) {
			CustomService c = new CustomService();
            c.setCode("color_" + i);
            c.setSeller(g);
            this.customServiceManager.save(c);
        }
	}

}
